<template lang="html">
  <div class="main-page" id="user-page">
    <!-- 标题 -->
    <!-- <van-nav-bar class="main-header" :title="title" :left-arrow="true" :fixed="true" :z-index="11" @click-left="onClickLeft"/> -->
    <nav-bar :title="title" @goBack="onClickLeft"/>
    <!-- 主体内容 -->
    <div class="main-content has-main-tabbar has-header-space">
      <div>
      <!-- 定位tab -->
      <!-- 轮播图 -->
       <swiper :data="ProductInfo.item_image_row"></swiper>
      <!-- 价格名称 -->
       <div>
         <div class="spike">
           <div class="spike-item">
           <template v-for="(tab_item, tabIndex) in ProductInfo.activity_tab_names" :index="tabIndex" >
               <div class="spike-item-title" v-if="ProductInfo.activity_tab_names.length !== 0 && tab_item !== ''" :key="tabIndex">{{tab_item}}</div>
           </template>
           <div class="spike-time" v-if="ProductInfo.activity_type_name && isshow_spike">
             <span class="spike-time-them">距结束: </span>
             <span class="spike-time-text">{{wxTimerHour}}</span>
             <span>:</span>
             <span class="spike-time-text">{{wxTimerMinute}}</span>
             <span>:</span>
             <span class="spike-time-text">{{wxTimerSecond}}</span>
           </div>
         </div>
           <!--价格 -->
           <div class="spike-price">
             <span class="spike-item-price">
               <span style="color:#FFFFFF;font-size:22px;margin-right:10px;">￥{{ ProductInfo.activity_type_name ? ProductInfo.activity_item_row.activity_item_price : ProductInfo.item_unit_price}}</span>
               <span style="color:#FFFFFF;font-size:15px;text-decoration:line-through;">￥{{ProductInfo.activity_type_name ? ProductInfo.item_unit_price : ProductInfo.item_market_price}}</span>
             </span>
             <div class="spike-inventory">
             库存：{{ datas.product_freight_info.if_store ? ProductInfo.item_quantity : 0}}件
            </div>
          </div>
        </div>
         <!-- 商品名称 -->
         <div class="detail-shop">
           <div class="detail-shop-name">{{ProductInfo.product_name}}</div>
           <div class="detail-shop-desc" v-if="ProductInfo.product_tips">{{ProductInfo.product_tips}}</div>
         </div>
       </div>
      <!-- 规格参数选择 -->
       <div class="detail-specification">
       <van-cell value="..." @click="shopShow" value-class="detail-specification-value">
         <div slot="title">
           <span class="detail-specification-text">规格</span>
           <span class="detail-specification-name">{{selectSpecifications}}</span>
         </div>
         </van-cell>
         <div bindtap="detailShows" style="padding:15px;background-color:#ffffff;font-size:13px;" >
         <div class="detail-show-title">
         <template v-for="(c_item, cIndex) in contractList" :index="cIndex">
           <div :key="cIndex" style="display:inline-block;">
             <img class="explain-icon1" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/success_icon.png" alt=""><span class="specification-tag">{{c_item.contract_type_name}}</span>
           </div>
        </template>
       </div>
         <span style="float:right;color:#999999" bindtap="detailShows">...</span>
       </div>
     </div>
     <!-- 图文详情 -->
       <template v-if="ProductInfo.product_detail_img || ProductInfo.product_param_img || ProductInfo.product_service_img">
        <div style="margin-bottom:60px;">
         <van-cell>
         <div slot="title">
           <span class="evaluation-title">商品详情</span>
         </div>
         </van-cell>
            <div v-if="ProductInfo.product_detail_img || ProductInfo.product_detail_img != ['']" style="text-align:center;background:#ffffff;">
              <template v-for="(i, ind) in ProductInfo.product_detail_img"  :index="ind">
                <img mode="widthFix" style="width:100%;" v-if="i !== ''" :key="ind" :src="i" alt="">
              </template>
            </div>
           <div v-if="ProductInfo.product_param_img || ProductInfo.product_param_img != ['']" style="text-align:center;background:#ffffff;">
             <template v-for="(param_item, index) in ProductInfo.product_param_img"  :index="index">
               <img mode="widthFix" style="width:100%;" v-if="param_item !== ''" :key="index"  :src="param_item" alt="">
             </template>
           </div>
             <div v-if="ProductInfo.product_service_img || ProductInfo.product_service_img != ['']" style="text-align:center;background:#ffffff;">
               <template v-for="(service_item, service_indx) in ProductInfo.product_service_img"  :index="service_indx">
                 <img mode="widthFix" style="width:100%;" v-if="service_item !== ''" :key="service_indx" :src="service_item" alt="">
               </template>
           </div>
         </div>
       </template>
       <!-- 促销弹框 -->

      <!-- 规格弹出框 -->
       <!-- <div>
         <van-popup v-model="show" position="bottom" bind:click-overlay="closeShop">
           <van-card tag="ProductInfo.activity_type_name"  thumb="ProductInfo.product_image">
              <div slot="title" style="float:right;">
                 <van-icon name="cross" size="22px" bind:click="closeShop"/>
               </div>
             <div slot="desc" class="popup-item-price">
             <span style="color:#E91F3F;font-size:18px;">￥{{ ProductInfo.activity_type_name ? ProductInfo.activity_item_row.activity_item_price : ProductInfo.item_unit_price}}</span>
           </div>
               <div slot="tags">
                 <span style="color:#999999;font-size:12px;">库存：{{ datas.product_freight_info.if_store ? ProductInfo.item_quantity : 0}}件</span>
                 <div style="color:#17273A;font-size:13px;">已选：{{ProductInfo.item_spec_name}}</div>
               </div>
               </van-card> -->
          <!-- 规格 -->
          <!-- <div class="item" v-for="(items, indx) in ProductInfo.product_spec" :index="indx" :key="indx">
           <div class="item-title">{{items.name}}</div>
             <template v-for="(j, index) in items.item" :index="index">
             <div v-if="j.select === 1" class="sellabel" :key="index">{{j.name}}</div>
             <div v-else :class="ProductInfo.spec_item_map[j.id] ? 'item_nodisabled' : 'item_disabled'" @click="selectsps(j,items)">{{j.name}}</div>
           </template>
          </div> -->
          <!-- 数量 -->
           <!-- <div class="item" v-if="ProductInfo.is_gift_bag !== 1">
           <div class="item-title">数量</div>
           <van-stepper v-model="shopNum" input-class="stepper-input"  plus-class="stepper" minus-class="stepper" integer min="1" :max="ProductInfo.item_quantity" @change="onChange"/>
         </div>
         <div class="shop-nav">
         <template v-if="userData.user_info.lev_name === '普通用户'">
         <div class="bottom-btn">
           <template v-if="ProductInfo.activity_type_name || ProductInfo.is_gift_bag === 1 || ProductInfo.is_limit">
           <div v-if="btn_dis" class="now-dis">
         <div class="now-item">立即抢购</div>
       </div>
          <div v-else class="now">
         <div class="now-item" catchtap="buynow">立即抢购</div>
       </div>
     </template>
           <template v-else>
             <van-row>
             <van-col span="12">
              <div class="again-buy1" bindtap="addCard">加入购物车</div>
             </van-col>
             <van-col span="12">
              <div class="again-buy" bindtap="buynow">购买</div>
             </van-col>
           </van-row>
         </template>
         </div>
       </template> -->
         <!--  -->
         <!-- <template v-else>
           <div class="bottom-btn" v-if="ProductInfo.activity_type_name || ProductInfo.is_gift_bag === 1 || ProductInfo.is_limit">
           <template v-if="earnings.buy_profit > 0">
             <van-row>
               <van-col span="12">
                <div class="buy2" bindtap="buynow">
                 <div class="buy-item" :style="{ padding-top: earnings.buy_profit > 0 ? '7px': '14px'}">购买</div>
                 <div v-if="earnings.buy_profit > 0" style="font-size:11px;padding-bottom:7px;" >省￥{{earnings.buy_profit}}</div>
               </div>
               </van-col>
               <van-col span="12">
                 <div class="share" catchtap="shareShop" >
            <div class="share-item" :style="{ padding-top: earnings.share_profit > 0 ? '7px': '14px'}">分享</div>
            <div v-if="earnings.share_profit > 0" style="font-size:11px;" >赚￥{{earnings.share_profit}}</div>
          </div>
               </van-col>
             </van-row>
           </template>
            <template v-else>
            <div :class="btn_dis ? 'now-dis' : 'now'">
            <div class="now-item" catchtap="buynow">立即抢购</div>
          </div>
        </template>
          </div>
           <div class="bottom-btn" v-else>
           <template v-if="earnings.buy_profit > 0">
           <van-row>
           <van-col span="8">
             <div class="cart1" bindtap="addCard">
             <div class="buy-item" style="padding-top:15px;">加入购物车</div>
           </div>
           </van-col>
           <van-col span="8">
             <div class="buy" bindtap="buynow">
           <div class="buy-item" :style="{ padding-top: earnings.buy_profit > 0 ? '7px': '14px'}">购买</div>
            <div v-if="earnings.buy_profit > 0" style="font-size:11px;padding-bottom:7px;" >省￥{{earnings.buy_profit}}</div>
          </div>
               </van-col>
               <van-col span="8">
               <div class="share2" catchtap="shareShop">
               <div class="share-item" :style="{ padding-top: earnings.share_profit > 0 ? '7px': '14px'}">分享</div>
               <div v-if="earnings.share_profit > 0" style="font-size:11px;padding-bottom:7px;" >赚￥{{earnings.share_profit}}</div>
            </div>
               </van-col>
             </van-row>
           </template>
          <template v-else>
           <van-row>
             <van-col span="8">
              <div class="cart" style="padding:14px 0;">
             <div class="buy-item" bindtap="addCard" >加入购物车</div>
           </div>
             </van-col>
             <van-col span="8">
              <div class="buy1" style="padding:14px 0;">
            <div class="buy-item" bindtap="buynow">购买</div>
          </div>
             </van-col>
             <van-col span="8">
               <div class="share1" style="padding:14px 0;">
               <div class="buy-item" bindtap="shareShop">分享</div>
             </div>
             </van-col>
           </van-row>
         </template>
        </div>
      </template>
       </div>
        </van-popup>
      </div> -->

       <!-- 服务说明 -->
        <div>
         <van-popup v-model="detailShow" position="bottom" @click-overlay="detailCloseShop" custom-class="popup-height" >
          <van-cell>
           <van-icon name="cross" size="22px" @click="detailCloseShop"/>
             <div slot="title">
               <div class="explain-text">服务说明</div>
             </div>
           </van-cell>
           <div v-for="(c_items, cIndex) in contractList" :index="cIndex" :key="cIndex" class="explain">
           <div style="padding:16px 0 10px 0;">
            <img class="explain-icon" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/success_icon.png" alt="">
             <span class="explain-name">{{c_items.contract_type_name}}</span>
           </div>
           <div class="type-text">{{c_items.contract_type_text}}</div>
         </div>
           <van-button size="large" custom-class="detail-btn" @click="detailCloseShop">完成</van-button>
            <!-- <div class="{{isIphoneX?'isX':''}}"></div> -->
        </van-popup>
      </div>
      <!-- 分享/发图素材 -->
       <!-- <div class="share-shop">
       <navigator v-if="userData.user_info.lev_name !== '普通用户'" url="/pages/circleMaterial/circleMaterial?pid={{proId}}&invite_id={{userData.user_info.invite_id}}&color_id={{ProductInfo.color_id}}&item_id={{ProductInfo.item_id}}" style="display:inline-block;">
           <img class="share-shop-item1" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/material_icon.png" alt="">
          </navigator>
           <img class="share-shop-item2" data-share_prd_id="{{ProductInfo.product_id}}" data-share_title="{{ProductInfo.product_name}}" data-share_img="{{ProductInfo.product_image}}"  catchtap="shareShop" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/share_icon.png" alt="">
       </div> -->
              <!-- 置顶/客服/加购 -->
       <!-- <div class="share-shop1">
         <div style="margin-left:5px;margin-bottom:10px;width:40px;height:50px;border-radius: 50%;">
           <navigator url="/pages/member/message_center/customer_service/customer_service?pid={{ProductInfo.item_id}}&type=prd&merchant_id={{ProductInfo.merchant_code}}" style="display:inline-block;">
             <img class="share-shop-item" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/service_icon.png" alt="">
          </navigator>
        </div>
         <navigator url="/pages/shopping_cart/shopCart" open-type="switchTab" style="display:inline-block">
           <img class="share-shop-item3" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/cart_icon.png" alt="">
          </navigator>
          <div hidden='{{!floorstatus}}' class="share-shop-item3" bindtap="goTop">
          <img class="share-shop-item3" src="https://mjmh.meijiameihuo.com/wechat/images/shopping_cart/stick_icon.png" style="margin-left:3px;" alt="">
       </div>
     </div> -->
       <!-- 商品导航 -->
       <!-- <div class="shop-nav">
       <template v-if="userData.user_info.lev_name === '普通用户'">
       <div class="bottom-btn">
           <div v-if="ProductInfo.activity_type_name || ProductInfo.is_gift_bag === 1 || ProductInfo.is_limit">
            <div v-if="btn_dis|| isBuy === '1'" class="now-dis">
           <div class="now-item">立即抢购</div>
           </div>
            <div v-else class="now">
           <div class="now-item" catchtap="shopShow">立即抢购</div>
         </div>
          </div>
           <div v-else>
           <van-row>
             <van-col span="12">
              <div class="again-buy1" bindtap="shopShow">加入购物车</div>
             </van-col>
             <van-col span="12">
              <div class="again-buy" bindtap="shopShow">购买</div>
             </van-col>
           </van-row>
         </div>
         </div>
       </template>
         <template v-else>
           <div class="bottom-btn" v-if="ProductInfo.activity_type_name || ProductInfo.is_gift_bag === 1 || ProductInfo.is_limit">
           <div v-if="earnings.buy_profit > 0">
             <van-row>
               <van-col span="12">
                <div class="buy2" bindtap="shopShow">
                 <div class="buy-item" :style="{padding-top:earnings.buy_profit > 0 ? '7px': '14px'}">购买</div>
                 <div v-if="earnings.buy_profit > 0" style="font-size:11px;padding-bottom:7px;" >省￥{{earnings.buy_profit}}</div>
               </div>
               </van-col>
               <van-col span="12">
                 <div class="share" catchtap="shareShop" >
               <div class="share-item" :style="{padding-top:earnings.share_profit > 0 ? '7px': '14px'}">分享</div>
                <div v-if="earnings.share_profit > 0" style="font-size:11px;" >赚￥{{earnings.share_profit}}</div>
               </div>
               </van-col>
             </van-row>
           </div>
           <div v-else>
             <div v-if="btn_dis|| isBuy === '1'" class="now-dis">
           <div class="now-item">立即抢购</div>
         </div>
            <div v-else class="now">
           <div class="now-item" catchtap="shopShow">立即抢购</div>
         </div>
       </div>
         </div>
           <div class="bottom-btn" v-else>
             <div v-if="earnings.buy_profit > 0">
             <van-row>
               <van-col span="8">
                 <div class="cart1" bindtap="shopShow">
                 <div class="buy-item" style="padding-top:15px;">加入购物车</div>
               </div>
               </van-col>
               <van-col span="8">
                <div class="buy" bindtap="shopShow">
               <div class="buy-item" :style="{padding-top:earnings.buy_profit > 0 ? '7px': '14px'}">购买</div>
            <div v-if="{{earnings.buy_profit > 0}}" style="font-size:11px;padding-bottom:7px;" >省￥{{earnings.buy_profit}}</div>
          </div>
               </van-col>
               <van-col span="8">
               <div class="share2" catchtap="shareShop">
                 <div class="share-item" :style="{padding-top:earnings.share_profit > 0 ? '7px': '14px'}">分享</div>
                 <div v-if="{{earnings.share_profit > 0}}" style="font-size:11px;padding-bottom:7px;" >赚￥{{earnings.share_profit}}</div>
               </div>
               </van-col>
             </van-row>
           </div>
           <div v-else>
           <van-row>
             <van-col span="8">
              <div class="cart" style="padding:14px 0;">
             <div class="buy-item" bindtap="shopShow" >加入购物车</div>
           </div>
             </van-col>
             <van-col span="8">
              <div class="buy1" style="padding:14px 0;">
            <div class="buy-item" bindtap="shopShow">购买</div>
          </div>
             </van-col>
             <van-col span="8">
               <div class="share1" style="padding:14px 0;">
               <div class="buy-item" bindtap="shareShop">分享</div>
             </div>
             </van-col>
           </van-row>
         </div>
         </div>
         </template>
       </div> -->
       <!-- 导航 -->
       <div class="shop-nav">
         <van-row gutter="40">
           <van-col span="3">
             <div class="logo">
               <img style="width:100%;height:100%;" src="https://mjmh.meijiameihuo.com/wechat/images/common/logon.png" alt="">
             </div>
           </van-col>
           <van-col span="9">
             <img class="open-img" @click="openApp" src="https://mjmh.meijiameihuo.com/wechat/images/common/nowOpen.png" alt="">
             <div class="open-text">打开客户端专享优惠</div>
           </van-col>
           <van-col span="12">
             <div style="">
               <span class="code-text">长按识别二维码</span>
               <div class="code-img">
                 <img class="" src="" alt="">
               </div>
             </div>
           </van-col>
         </van-row>
       </div>
     </div>
<!-- <template is="share" data="{{shareInfo, openShare}}" /> -->
    </div>
  <van-toast id="van-toast" />
  <van-dialog id="van-dialog" />
  </div>
</template>

<script>
import Swiper from '@/components/global/swiper.vue'
import NavBar from '@/components/global/nav-bar.vue'

export default {
  components: { Swiper, NavBar },
  data () {
    return {
      active: 3,
      title: '',
      userData: {},
      proId: null, // 产品id
      item_id: null,
      activity_id: null,
      activity_name: '',
      ProductInfo: {},
      SpecLst: [],
      splistStr: [],
      splist: [],
      pname: '',
      selectimg: '',
      selectsp: 0,
      selectct: 0,
      numval: 1,
      inputval: 1,
      stock: 1,
      skuid: 0,
      openShare: false,
      selectSpecifications: '请选择规格',
      evaluationNum: 1234,
      wxTimerList: {},
      shopNum: 1,
      cardNum: null,
      show: false,
      detailShow: false,
      promotionShow: false,
      keys: null,
      addressFlag: true,
      addressList: [
      ],
      defaultAddress: '请选择送货地址',
      name: '',
      mobile: null,
      attention_icon_color: '',
      attention_icon_Flag: false,
      addressInfo: null,
      contractList: [],
      datas: {
        product_freight_info: { if_store: '' }
      },
      marketPrice: '',
      product_spec: '',
      plainChange: true,
      earnings: {},
      floorstatus: false,
      spec_name: '',
      isshow_spike: false,
      btn_dis: false,
      isIphoneX: false,
      isBuy: null,
      isShelves: null
    }
  },
  created () {
    console.log(this.$route)
    if (this.$route.query.item_id) {
      this.activity_id = this.$route.query.activity_id ? this.$route.query.activity_id : ''
      this.activity_name = this.$route.query.activity_name ? this.$route.query.activity_name : ''
      this.item_id = this.$route.query.item_id ? this.$route.query.item_id : ''
      this.isBuy = this.$route.query.isBuy ? this.$route.query.isBuy : ''
      this.isShelves = this.$route.query.isShelves ? this.$route.query.isShelves : ''
      this.initProduct(this.item_id, this.activity_id, this.activity_name)
    }
    // this.initProduct(334)
    // this.getUserInfo()
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    buyNow () {
    },
    onChange (e) {
      this.shopNum = ''
    },
    shopShow () { // 规格弹窗展示
      this.show = true
    },
    closeShop () { // 规格弹窗关闭
      this.show = false
    },
    detailShows () { // 说明展示
      this.detailShow = true
    },
    detailCloseShop () { // 说明关闭
      this.detailShow = false
    },
    onPageScroll (e) { // 获取页面滚动高度
      // console.log(e)
      if (e.scrollTop > 1440) {
        this.floorstatus = true
      } else {
        this.floorstatus = false
      }
    },
    goTop (e) { // 一键回到顶部
      // console.log(e)
      // wx.pageScrollTo({
      //   scrollTop: 0,
      //   duration: 500
      // })
    },
    openApp () {
      console.log('打开app')
      let u = navigator.userAgent
      if (u.indexOf('iPhone') !== -1) {
        window.location.href = 'https://itunes.apple.com/cn/app/id1400647356?mt=8'
      } else {
        this.getApp()
      }
    },
    getApp () { // 获取安卓链接
      console.log('打开安卓')
    },
    getEarningsInfo () { // 获取赚收益信息
      var params = {
        item_id: this.ProductInfo.item_id,
        price: this.ProductInfo.activity_type_name ? this.ProductInfo.activity_item_row.activity_item_price : this.ProductInfo.item_unit_price
      }
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'product_profit', params, method: 'get' }).then((res) => { // 请求成功
          console.log(res)
          if (res.return_code === '0000') {
            if (res.data) {
              this.earnings = res.data
            }
            console.log('请求成功')
          } else {
            console.log('请求错误')
          }
          resolve(res)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    },
    isBuygiftBag () { // 是否可以再次购买大礼包
      var data = {}
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'help_check_user', data, method: 'get' }).then((res) => { // 请求成功
          console.log(res)
          if (res.return_code === '1111') {
            this.isBuy = '1'
            this.$dialog.alert({
              message: '这是礼包商品，您已开通会员啦，去首页看看。',
              confirmButtonText: '我知道啦'
            }).then(() => {
              // wx.switchTab({
              //   url: '/pages/tabbar/home/home',
              // })
            })
            console.log('请求成功')
          } else {
            console.log('请求错误')
          }
          resolve(res)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    },
    ckselectsp: function (e) {
      this.change = e.currentTarget.offsetLeft
      this.selectsp = 1
      this.selectct = 1
      this.flag = !0
      this.flag1 = !1
      e.currentTarget.dataset.type === 1 ? this.isModified = !0 : this.isModified = !1
    },
    selectsps (value1, value2) { // 选择商品规格事件处理
      console.log(value1, value2)
      this.plainChange = false
      var params = { spid: value1.spid, ckid: value2.ckid, unit_id: value2.unit_id }
      var uniqid = []
      var specIds = []
      for (var specKey in this.ProductInfo.item_spec) {
        if (params.unit_id === this.ProductInfo.item_spec[specKey].id) {
          specIds.push(params.spid)
        } else {
          specIds.push(this.ProductInfo.item_spec[specKey].item.id)
        }
      }
      uniqid = specIds.sort(function (a, b) {
        return a - b
      }).join('-')
      console.log(uniqid)
      var itemId = this.ProductInfo.product_uniqid[uniqid][0]
      this.item_id = itemId

      // this.initProduct(this.item_id)
    },
    getUserInfo () { // 获取用户信息判断是否vip
      var data = {}
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'profile', data, method: 'get' }).then((resp) => { // 请求成功
          console.log(resp)
          if (resp.return_code === '0000') {
            if (resp.data) {
              this.userData = resp.data
            }
            console.log(this.userData)
            console.log('请求成功')
          } else {
            console.log('请求错误')
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    },
    addCard () { // 添加购物车
      var data = {
        item_id: this.item_id,
        cart_quantity: this.shopNum
      }
      if (this.stock <= 0) {
        this.$toast('亲~商品没有库存啦！')
        return
      }
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'user_cart', data, method: 'post' }).then((res) => { // 请求成功
          console.log(res)
          if (res.return_code === '0000') {
            this.$toast('添加购物车成功')
            this.selectct = 0
            this.show = false
            setTimeout(function () {
              this.selectsp = 0
            }, 1e3)
            console.log('请求成功')
          } else {
            console.log(res.msg)
          }
          resolve(res)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    },
    buynow () { // 立即购买
      if (this.stock <= 0) {
        this.$toast('亲~商品没有库存啦！')
        return
      }
      var params = {
        item_id: this.item_id,
        proName: this.ProductInfo.product_name,
        cart_quantity: this.shopNum,
        activity_id: this.ProductInfo.activity_id,
        SKU_Id: this.skuid
      }
      console.log(params)
      // wx.navigateTo({ url: "../shopping_cart/shopPayment/shopPayment?ifcart=0&cart_id=" + params.item_id + "|" + params.cart_quantity + '&address=' + this.data.defaultAddress + '&name=' + this.data.name + '&mobile=' + this.data.mobile + '&is_gift_bag=' + this.data.ProductInfo.is_gift_bag + '&activity_type_name=' + this.data.ProductInfo.activity_type_name + '&is_limit=' + this.data.ProductInfo.is_limit})
    },
    initProduct (id, value1, value2) { // 获取商品详情
      var params = {
        item_id: id,
        activity_id: value1,
        activity_name: value2
      }
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'product_detail', params, method: 'get' }).then((res) => { // 请求成功
          console.log(res)
          if (res.return_code === '0000') {
            if (res.data) {
              this.datas = res.data
              this.ProductInfo = res.data.item_row
              var contractList = [] // 处理ProductInfo.contractlist 规格
              for (let ind in this.ProductInfo.contractlist) {
                let index = ind
                let value = this.ProductInfo.contractlist[index]
                contractList.push(value)
              }
              this.contractList = contractList
              console.log(contractList)
              this.title = this.ProductInfo.product_item_name
            }
            console.log('请求成功')
          } else {
            console.log('请求错误')
          }
          resolve(res)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.detail-swiper .slide-image {
  height: 187px;
  width: 100%;
}
.detail-show-title{
  display: inline-block!important;
  word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;
}
.prd_price .buy_price {
  height: 18px;
  line-height: 18px;
  background: #dfc399;
  display: inline-block;
  color: #fff;
  padding: 0 5px;
  position: relative;
  vertical-align: middle;
}
.prd_price .price_icon {
  display: inline-block;
  width: 13px;
  height: 18px;
  background-repeat: no-repeat;
  background-size: contain;
  vertical-align: middle;
}
.prd_price .buy_tips {
  vertical-align: middle;
  height: 18px;
  line-height: 18px;
  padding: 0 5px 0 2px;
  color: #ddb074;
}
.spike{
  background-color: #E91F3F;
  padding: 5px 10px;
}
.spike-item-title{
  display: inline-block;
  color: #FFFFFF;
  background-color: #BA122D;
  font-size: 10px;
  padding: 2px 4px;
  margin-left:5px;
  border-radius:2px;
}
.spike-time{
  /* display: inline-block; */
  float: right;
  font-size: 12px;
  color: #FFFFFF;
  margin: 5px 0 0 0;
}
.spike-inventory{
  display: inline-block;
  position:absolute;
  right:0;
  top:8px;
  color:#FFFFFF;font-size:13px;
}
.detail-shop{
  background-color: #ffffff;
  padding:15px;
  font-weight: bold;
}
.detail-shop-name{
  color: #17273A;
  font-size: 15px;
}
.detail-shop-desc{
  color: #999999;
  font-size: 12px;
  margin-top:10px;
}
.detail-specification{
  margin: 10px 0;
}
.detail-specification-text{
  margin-right: 15px;
  color: #666666;
  font-size: 14px;
}
.detail-specification-name{
  color: #17273A;
  font-size: 13px;
  font-weight: bold;
}
.shop-evaluation{
  margin-bottom: 10px;
}
.evaluation-title{
  color: #17273A;
  font-size: 18px;
  font-weight: bolder;
}
.evaluation-rate{
  color: #E91F3F;
  font-size: 14px;
}
.spike_list {
  padding: 10px 0 20px 15px;
  overflow: hidden;
  background-color: #FFFFFF;
}
.spike-price{
  position:relative;
}
.scroll-view_H {
  white-space: nowrap;
  display: flex;
}
::-webkit-scrollbar {
  width: 0;
  height: 0;
  color: transparent;
}
.home_spike_item {
  width: 105px;
}
.explain-text{
  font-size: 22px;
}
.explain{
  font-size: 12px!important;
  color: #17273A!important;
  background-color: #FFFFFF;
}
.explain-icon{
  position:relative;
  top:3px;
  left:0;
  width:18px;
  height:18px;
  padding: 0 10px 0 15px;
}
.explain-icon1{
  position:relative;
  top:2px;
  left:0;
  width:15px;
  height:15px;
  padding-right: 5px;
}
.specification-tag{
   margin:10px 10px 10px 0;
}
.type-text{
  color: #999999;
  font-size: 14px;
  padding:0 40px 0 45px;
}
.explain-name{
  font-size: 16px;
}
.detail-btn{
  position: fixed!important;
  bottom:0;
  background-color: #E91F3F!important;
  color: #ffffff!important;
}
.van-button--default{
  border:0!important;
}
.van-popup--safe{
  padding-bottom: 0!important;
}
.item{
  /* border: 1px solid red; */
  margin: 15px;
}
.item-title{
  color: #17273A;
  font-size: 15px;
  font-weight: bolder;
  padding-bottom: 10px;
}
.popup-item-price{
  margin-top: 25px;
}
.item_disabled{display:inline-block;color:#B5B5B5;font-size:14px;background-color:#F3F3F9;margin:0 15px 15px 0;border:1px solid #F3F3F9;border-radius: 0.9em;padding:0.2em 0.6em;}
.item_nodisabled{display:inline-block;color:#17273A;font-size:14px;background-color: #F3F3F9;margin:0 15px 15px 0;border:1px solid #F3F3F9;border-radius: 0.9em;padding:0.2em 0.6em;}
.sellabel{display:inline-block;color:#DB384C;font-size:14px;background-color: #FBF1F3;border:1px solid #E91F3F;
border-radius: 0.9em;margin:0 15px 15px 0;padding:0.2em 0.6em;}
.van-stepper__minus,.van-stepper__plus{width:20px!important;height:20px!important;color:#C3CDD6!important;border:1px solid  #C3CDD6!important;}.stepper-input{width:40px!important;height:40px!important;}.van-stepper__input-wrapper{border-bottom:1px solid  #C3CDD6!important;border-top: 1px solid  #C3CDD6!important; }
.detail-specification-value{
  flex: none!important;
}
.share-shop{
  /* width: 80rpx; */
  position: fixed;
  right:5%;
  top:2%;
  z-index: 10;
  color:#ffffff;
  text-align: center;
}
.share-image{
  width:67px;
  height:30px;
}
.share-shop1{
  /* width: 80rpx; */
  height:164px;
  position: fixed;
  right:5%;
  bottom:15%;
  z-index: 10;
  color:#ffffff;
  text-align: center;
}
.share-shop-item1{
  width:68px;
  height:30px;
  display: inline-block;
  margin-right: 10px;
}
.share-shop-item{
  width:40px;
  height:45px;
  margin-right:3px;
}
.share-shop-item2{
  display: inline-block;
  width:30px;
  height:30px;
  border-radius: 50%;
  /* border:1px solid red; */
}
.share-shop-item3{
  width:40px;
  height:40px;
  border-radius: 50%;
  margin-bottom: 10px;
}
.navigator-hover{
  opacity: 1!important;
  background-color:rgba(0, 0, 0, 0)!important;
}
.share-text{
  width: 40px!important;
  height: 40px!important;
  padding-bottom: 5px;
}
.again-buy{
  height: 100%;
  font-size: 15px;
  color: #FFFFFF;
  text-align: center;
  padding: 14px 0;
  background-image:linear-gradient(90deg, #ECD8B6,#D5B07F, #D5B07F);
}
.again-buy1{
  height: 100%;
  font-size: 15px;
  text-align: center;
  color: #FFFFFF;
  padding: 14px 0;
  background-image:linear-gradient(90deg, #393939,#262626, #262626);
}
.now-buy{
  background-color:#E91F3F!important;
}
.btn{
  padding:0!important;
  background-color: #FFFFFF!important;
}
/*底部按钮*/
// .bottom-btn{
//   width:100%;
//   /* height:49px; */
//   position: fixed;
//   bottom:0;
//   left:0;
// }
// /* 会员有佣金 */
// .buy{
//   height:49px;
//   text-align: center;
//   background-image:linear-gradient(90deg, #ECD8B6,#D5B07F, #D5B07F);
//   color: #FFFFFF;
// }
// .cart1{
//   height:49px;
//   text-align: center;
//   /* padding-top:14px 0; */
//  background-image:linear-gradient(90deg, #393939,#262626, #262626);
//   color: #FFFFFF;
// }
// .share2{
//   height:49px;
//   text-align: center;
//   background-color:#E91F3F;
//   color: #FFFFFF;
// }
// /* .. */
// /* 无佣金会员 */
// .buy1{
//   height:100%;
//   text-align: center;
//   background-image:linear-gradient(90deg, #ECD8B6,#D5B07F, #D5B07F);
//   color: #FFFFFF;
// }
// .share1{
//   height:100%;
//   text-align: center;
//   background-color:#E91F3F;
//   color: #FFFFFF;
// }
// .cart{
//   height:100%;
//   text-align: center;
//  background-image:linear-gradient(90deg, #393939,#262626, #262626);
//   color: #FFFFFF;
// }
// /* 活动会员 */
// .share{
//   height:49px;
//   text-align: center;
//   background-color:#E91F3F;
//   color: #FFFFFF;
// }
// .buy2{
//   height:49px;
//   text-align: center;
//   background-image:linear-gradient(90deg, #ECD8B6,#D5B07F, #D5B07F);
//   color: #FFFFFF;
// }
// /*  */
// .buy-item{
//   font-size: 15px;
// }
// .share-item{
//   font-size: 15px;
// }
// .now{
//   width:100%;
//   height:100%;
//   text-align: center;
//   padding:13px 0;
//   background-color:#E91F3F;
//   color: #FFFFFF;
// }
// .now-dis{
//   width:100%;
//   height:100%;
//   text-align: center;
//   padding:13px 0;
//   background-color:#D0D0D0;
//   color: #FFFFFF;
// }
// .now-item{
//   font-size: 15px;
// }
.shop-nav{
  width: 100%;
  position:fixed;
  bottom:0;
  left:0;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 12px 15px;
}
.logo{
  width: 50px;
  height: 50px;
}
.code-img{
  display: inline-block;
  width: 45px;
  height: 45px;
  background-color: #D5AA72;
}
.open-img{
  width: 70px;
  height: 23px;
  margin-top:4px;
}
.code-text{
  position: relative;
  top: 15px;
  right: 6px;
  color: #FFFFFF;
  font-size: 10px;
  padding: 15px 0;
}
.open-text{
  color: #FFFFFF;
  font-size: 10px;
  // margin-top:4px;
}
</style>
